package com.doraemon.mapper;

import com.doraemon.entity.Setmeal;
import com.doraemon.entity.SetmealDish;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 套餐菜品管理Mapper
 **/
@Mapper
public interface SetmealDishMapper {

    /***
     * 根据 菜品id集合 获取对应的套餐id集合
     * ---
     * @param dishIds 菜品id集合
     * @return: java.util.List<java.lang.Long>
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /***
     * 插入 套餐菜品 数据
     * ---
     * @param setmealDish 套餐菜品实体
     * @return: void
     */
    void insert(SetmealDish setmealDish);

    /***
     * 根据 套餐id 获取套餐实体
     * ---
     * @param id 套餐id
     * @return: com.doraemon.entity.Setmeal 套餐实体
     */
    @Select("select * from setmeal where id = #{id}")
    Setmeal getById(Long id);

    /***
     * 根据 套餐id 删除套餐菜品信息
     * ---
     * @param id 套餐id
     * @return: void
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId(Long id);

    /***
     * 根据 套餐id 获取套餐菜品实体集合
     * ---
     * @param id 套餐id
     * @return: java.util.List<com.doraemon.entity.SetmealDish>
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getListBySetmealId(Long id);
}
